{% extends 'user_form.html' %}


{% block other_buttons %}
    <button id='send_code'class="btn btn-primary">发送验证码</button>
{% endblock %}
{% block script_extends %}
    <script type="text/javascript">
        $("#send_code").click(function () {
            var email = $("#id_email").val();
            if(email == ""){
                $("#tip").text("邮箱不能为空");
                return false;
            }
            //发送验证码
            $.ajax({
                    url:"{% url 'send_verification_code' %}",
                    type:"GET",
                    data:{
                        'email':email
                    },
                    cache:false,
                    success:function (data) {
                        if(data['status']=='ERROR'){
                            alert(data['status']);
                        }
                    }
                }
            );
        });
    </script>
{% endblock %}